﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="zreport.ascx.cs" Inherits="admin_zreport" %>
<asp:Panel ID="Panel1" runat="server">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="FleetID,TaxiID" 
    DataSourceID="SqlDataSource1" style="margin-top: 15px" 
    CssClass="GridViewStyle" Width="835px">
    <Columns>
        <asp:CommandField ShowSelectButton="True" SelectText="+" />
        <asp:BoundField DataField="FleetID" HeaderText="FleetID" ReadOnly="True" 
            SortExpression="FleetID" />
        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        <asp:BoundField DataField="TotalRevenue" HeaderText="TotalRevenue" 
            SortExpression="TotalRevenue" />
        <asp:BoundField DataField="TaxiID" HeaderText="TaxiID" InsertVisible="False" 
            ReadOnly="True" SortExpression="TaxiID" />
        <asp:BoundField DataField="PlateNo" HeaderText="PlateNo" 
            SortExpression="PlateNo" />
        <asp:BoundField DataField="DailyKm" HeaderText="DailyKm" 
            SortExpression="DailyKm" />
        <asp:BoundField DataField="TotalKm" HeaderText="TotalKm" 
            SortExpression="TotalKm" />
        <asp:BoundField DataField="Revenue" HeaderText="Revenue" 
            SortExpression="Revenue" />
    </Columns>
    
    <RowStyle CssClass="RowStyle" />
    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
    <PagerStyle CssClass="PagerStyle" />
    <SelectedRowStyle CssClass="SelectedRowStyle" />
    <HeaderStyle CssClass="HeaderStyle" />
    <EditRowStyle CssClass="EditRowStyle" />
    <AlternatingRowStyle CssClass="AltRowStyle" />



</asp:GridView>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Z Report" 
    BackColor="#151613" BorderColor="Yellow" BorderWidth="1px" Font-Size="Large" 
    ForeColor="#FFF000" />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    SelectCommand="SELECT dbo.Fleet.ID AS FleetID, dbo.Fleet.Name, dbo.Fleet.TotalRevenue, dbo.Taxi.ID AS TaxiID, dbo.Taxi.PlateNo, dbo.Taxi.DailyKm, dbo.Taxi.TotalKm, dbo.Taxi.Revenue FROM dbo.Fleet INNER JOIN dbo.ConnectionTaxiFleet ON dbo.Fleet.ID = dbo.ConnectionTaxiFleet.FleetID INNER JOIN dbo.Taxi ON dbo.ConnectionTaxiFleet.TaxiID = dbo.Taxi.ID">
</asp:SqlDataSource>
<br />

<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

<br />
<br />
<br />

</asp:Panel>



<ul id="accordion">

	<li>Logs</li>
	<ul>
<asp:Panel ID="Panel2" runat="server">

    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource3" CssClass="GridViewStyle" Width="835px" 
        DataKeyNames="ID" >
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" 
                SortExpression="ID" InsertVisible="False" ReadOnly="True" />
            <asp:BoundField DataField="UserName" HeaderText="UserName" 
                SortExpression="UserName" />
            <asp:BoundField DataField="Type" HeaderText="Type" 
                SortExpression="Type" />
            <asp:BoundField DataField="Details" HeaderText="Details" 
                SortExpression="Details" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
        </Columns>
    <RowStyle CssClass="RowStyle" />
    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
    <PagerStyle CssClass="PagerStyle" />
    <SelectedRowStyle CssClass="SelectedRowStyle" />
    <HeaderStyle CssClass="HeaderStyle" />
    <EditRowStyle CssClass="EditRowStyle" />
    <AlternatingRowStyle CssClass="AltRowStyle" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:conn %>" 
        DeleteCommand="DELETE FROM [Logs] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [Logs] ([UserName], [Type], [Details], [Date]) VALUES (@UserName, @Type, @Details, @Date)" 
        SelectCommand="SELECT * FROM [Logs]" 
        UpdateCommand="UPDATE [Logs] SET [UserName] = @UserName, [Type] = @Type, [Details] = @Details, [Date] = @Date WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="Details" Type="String" />
            <asp:Parameter DbType="Date" Name="Date" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="Details" Type="String" />
            <asp:Parameter DbType="Date" Name="Date" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Panel>
    </ul>


	<li>Fleets</li>
	<ul>


<asp:Panel ID="Panel3" runat="server">

<asp:GridView ID="GridView3" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
    DataSourceID="SqlDataSource5"  CssClass="GridViewStyle" Width="835px">
    <Columns>
        <asp:CommandField ShowEditButton="True">
        <ItemStyle ForeColor="#151613" />
        </asp:CommandField>
        <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
            SortExpression="ID" />
        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        <asp:BoundField DataField="TotalRevenue" HeaderText="TotalRevenue" 
            SortExpression="TotalRevenue" />
        <asp:BoundField DataField="Town" HeaderText="Town" SortExpression="Town" />
        <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
        <asp:BoundField DataField="Slogan" HeaderText="Slogan" 
            SortExpression="Slogan" />
        <asp:BoundField DataField="Address" HeaderText="Address" 
            SortExpression="Address" />
    </Columns>
    <RowStyle CssClass="RowStyle" />
    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
    <PagerStyle CssClass="PagerStyle" />
    <SelectedRowStyle CssClass="SelectedRowStyle" />
    <HeaderStyle CssClass="HeaderStyle" />
    <EditRowStyle CssClass="EditRowStyle" />
    <AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource5" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    InsertCommand="INSERT INTO dbo.Fleet(ID, Name, TotalRevenue, Town, Phone, Slogan, Address) VALUES (,,,,,,)" 
    SelectCommand="SELECT ID, Name, TotalRevenue, Town, Phone, Slogan, Address FROM dbo.Fleet" 
    
        UpdateCommand="SELECT Name, TotalRevenue, Town, Phone, Slogan, Address FROM dbo.Fleet">
</asp:SqlDataSource>

</asp:Panel>
    </ul>
    <li>Taxis</li>
    <ul>
<asp:Panel ID="Panel4" runat="server">

    <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource6"  CssClass="GridViewStyle" Width="835px" 
        AllowPaging="True" AllowSorting="True">
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="PlateNo" HeaderText="Plate" 
                SortExpression="PlateNo" />
            <asp:BoundField DataField="DailyKm" HeaderText="DailyKm" 
                SortExpression="DailyKm" />
            <asp:BoundField DataField="TotalKm" HeaderText="TotalKm" 
                SortExpression="TotalKm" />
            <asp:BoundField DataField="Revenue" HeaderText="Revenue" 
                SortExpression="Revenue" />
            <asp:BoundField DataField="Available" HeaderText="Available" 
                SortExpression="Available" />
            <asp:BoundField DataField="MaxKmLimit" HeaderText="MaxKmLimit" 
                SortExpression="MaxKmLimit" />
            <asp:CheckBoxField DataField="DayNight" HeaderText="DayNight" 
                SortExpression="DayNight" />
            <asp:BoundField DataField="CustomerArriveTime" HeaderText="ArriveTime" 
                SortExpression="CustomerArriveTime" />
            <asp:BoundField DataField="DriverUserName" HeaderText="Driver Name" 
                SortExpression="DriverUserName" />
            <asp:BoundField DataField="CurrentLocation" HeaderText="Location" 
                SortExpression="CurrentLocation" />
        </Columns>
    <RowStyle CssClass="RowStyle" />
    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
    <PagerStyle CssClass="PagerStyle" />
    <SelectedRowStyle CssClass="SelectedRowStyle" />
    <HeaderStyle CssClass="HeaderStyle" />
    <EditRowStyle CssClass="EditRowStyle" />
    <AlternatingRowStyle CssClass="AltRowStyle" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
        ConnectionString="<%$ ConnectionStrings:conn %>" 
        SelectCommand="SELECT PlateNo, DailyKm, TotalKm, Revenue, Available, MaxKmLimit, DayNight, CustomerArriveTime, DriverUserName, CurrentLocation FROM dbo.Taxi" 
        
        UpdateCommand="UPDATE dbo.Taxi SET PlateNo =, DailyKm =, TotalKm =, Revenue =, Available =, MaxKmLimit =, DayNight =, CustomerArriveTime =, DriverUserName =, CurrentLocation =">
    </asp:SqlDataSource>
</asp:Panel>
    </ul>
</ul>

  <script>
      $("#accordion > li").click(function () {

          if (false == $(this).next().is(':visible')) {
              $('#accordion > ul').slideUp(300);
          }
          $(this).next().slideToggle(300);
      });

//      $('#accordion > ul:eq(0)').show();

  </script>